//
//  WmcImageTailorPanControlView.swift
//  YPWatermarkCamera
//
//  Created by 赵新 on 2022/6/17.
//

import UIKit

class WmcImageTailorPanControlView: WmcBaseView {
    // Lifecycle

    override init(frame: CGRect) {
        super.init(frame: frame)
    }

    convenience init(image: UIImage,
                     edge: UIEdgeInsets = .zero) {
        self.init(frame: .zero)
        imageView.image = image
        self.edge = edge
        _makeUI()
    }

    @available(*, unavailable)
    public required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    // Internal

    lazy var imageView: UIImageView = {
        let imageView = UIImageView()
        return imageView
    }()

    var edge: UIEdgeInsets = .zero

    func _makeUI() {
        backgroundColor = nil
        
        addSubview(imageView)
        imageView.snp.makeConstraints { make in
            make.top.equalTo(edge.top)
            make.left.equalTo(edge.left)
            make.right.equalTo(-edge.right)
            make.bottom.equalTo(-edge.bottom)
        }
    }
}
